import React from "react";
import MarkdownPreview from "@uiw/react-markdown-preview";

interface MarkParseProps {
  text: string;
  theme?: "light" | "dark";
}

export default function MarkPreview({
  text,
  theme = "light",
  ...props
}: MarkParseProps) {
  return React.createElement(MarkdownPreview as any, {
    source: text,
    style: { padding: 16 },
    wrapperElement: { "data-color-mode": theme },
    ...props
  });
}
